{% extends "element/saas/base_mini.html" %}

{% block meta_title %}企业榜单{% endblock %}

{% block header %}{% endblock %}
{% block siderbar %}{% endblock %}
{% block footer %}{% endblock %}

{% block main %}
    <style>
        body {
            background: none;
        }
        .admin-content {
            padding: 0;
            border: none;
        }
    </style>
    <div class="admin-content">
        <div style="padding-top:3px;">
            <div id="datagrid_main" class="mini-datagrid" url="/saas/company_list/?method=loadtable&resfield=1" idField="entid"
                 allowResize="false" multiSelect="false" showColumnsMenu="true" pageSize="50"
                 virtualScroll="true" showReloadButton="false" showPageSize="false" sortField="{{ sortfield }}" sortOrder="desc">
                <div property="columns">
                    <div type="indexcolumn" width="20"></div>
                    <div field="entid" width="50" hideable="true" visible="false">序号</div>
                    <div field="REGNO" width="80" visible="false">注册号</div>
                    <div field="ENTNAME" width="180" hideable="true">企业名称</div>
                    <div field="revenue" width="60">营收总额</div>
                    <div field="total_profit" width="60">利润总额</div>
                    {% if "port" in sortfield %}
                        <div field="timport" width="60">年进口额</div>
                        <div field="texport" width="60">年出口额</div>
                    {% else %}
                        <div field="timport" width="60" hideable="true" visible="false">年进口额</div>
                        <div field="texport" width="60" hideable="true" visible="false">年出口额</div>
                    {% endif %}
                    <div field="region_id" width="80">所在地区</div>
                    <div field="nic_id" width="140">行业分类</div>
                    <div field="REGCAP" width="60">注册资金(万)</div>
                    <div field="ENTSTATUS" width="60">企业状态</div>
                    <div field="ESDATE" width="75" dateFormat="yyyy-MM-dd">开业日期</div>
                    <div field="OPSCOPE" width="180" visible="false">主营业务</div>
                </div>
            </div>
        </div>
    </div>
{% endblock %}

{% block footer_js %}
    <script type="text/javascript">
        mini.parse();
        var grid_main = mini.get("datagrid_main");
        top["win"] = window;
        var sfield = 'ENTNAME￥REGNO￥region_id￥nic_id￥elseic_id￥ENTSTATUS￥ENTTYPE￥OPSCOPE'
            + '￥REGCAP￥ESDATE￥revenue￥total_profit￥assets_re￥timport￥texport';
        var svalue = '￥￥' + getQueryString("region") + '￥' + getQueryString("nic") + '￥￥'
            + getQueryString("ENTSTATUS") + '￥￥￥$￥$￥$￥$￥$￥$￥$';
        grid_main.load({sfield: sfield, svalue: svalue});

        //获取url参数
        function getQueryString(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
            var r = window.location.search.substr(1).match(reg);
            if (r != null) return decodeURI(r[2]);
            return "";
        }
    </script>
    {{ block.super }}
{% endblock %}
